import { LeftOutline } from 'antd-mobile-icons';
import React, { Component } from 'react';
import '../styles/Like.scss'
import { like_list } from "../api/index";

class Like extends Component {
  constructor(props) {
    super(props)
    this.state = {
      list: []
    }
  }
  async componentDidMount() {
    var res = await like_list({ id: JSON.parse(localStorage.getItem('use')).id })
    console.log(res.data[0].like1);
    this.setState({ list: res.data[0].like1 })
  }
  back() {
    this.props.history.go(-1)
  }
  render() {
    return (
      <div className='like'>
        <div className="top6">
          <p><LeftOutline onClick={() => { this.back() }} /></p>
          <p>我的收藏</p>
          <p> </p>
        </div>
        <div className="main6">
          {
            this.state.list.map((item, index) => {
              return (
                <div className="item6" key={index}>
                  <div className="left61">
                    <img src={item.pic} alt="" />
                  </div>
                  <div className="right61">
                    <p >{item.name}</p>
                    <p className='p1'>{item.introduce}</p>
                    <p className='p2'>￥{item.price}</p>
                  </div>
                </div>

              )
            })

          }
        </div>
      </div>
    );
  }
}

export default Like;